package sk.tuke.constraintbuilder.views.components;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.MouseTrackListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.wb.swt.SWTResourceManager;

public class TypeChooserMouseListener implements MouseTrackListener, MouseListener{
	
	private TypeChooserPanel rootPanel;
	private Display display;
	
	public TypeChooserMouseListener(TypeChooserPanel rootPanel){
		this.rootPanel = rootPanel;
		this.display = Display.getCurrent();
	}

	@Override
	public void mouseDoubleClick(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseDown(MouseEvent e) {
		Label label = (Label) e.getSource();
		rootPanel.setText(label.getText());
	}

	@Override
	public void mouseUp(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseEnter(MouseEvent e) {
		Label label = (Label) e.getSource();
		label.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));
	}

	@Override
	public void mouseExit(MouseEvent e) {
		Label label = (Label) e.getSource();
		label.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
	}

	@Override
	public void mouseHover(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

}
